
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>角色列表</title>
    <style>
        td{
            text-align: center;
        }
        table,#queryDiv{
            width: 800px;
            margin: 20px auto;
        }
        #pageDiv{
            width: 80%;
            margin: 10px auto;
            text-align: right;
        }
    </style>
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

</head>
<body>
<div id="outer">
    <div id="queryDiv">
        <form action="" method="" id="queryForm">
            角色名：<input  name="name" value="${pageBean.queryObj.name}"/>
            <input type="button" value="查询" id="queryBtn">
        </form>

    </div>
    <table border="1" cellspacing="0">
        <tr>
            <th>序号</th>
            <th>角色名</th>
            <th>描述</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${pageBean.data}" var="role" varStatus="i">
            <tr>
               <td>${(pageBean.currentPage-1)*pageBean.pageSize+i.count}</td>
               <td>${role.name}</td>
               <td>${role.bz}</td>
               <td><a href="javascript:goAssign(${role.id})">分配权限</a></td>
            </tr>
        </c:forEach>
    </table>
    <div id="pageDiv">
        <span>当前${pageBean.currentPage}/${pageBean.pages}页</span>
        <span>总共${pageBean.totalSize}条记录</span>
        <a href="javascript:goPage(1)">首页</a>
        <a href="javascript:goPage(${pageBean.currentPage-1})">上一页</a>
        <a href="javascript:goPage(${pageBean.currentPage+1})">下一页</a>
        <a href="javascript:goPage(${pageBean.pages})">尾页</a>
    </div>
</div>
<script>
    function goPage(arg){
        var form = document.getElementById("queryForm");
        form.action="<%=request.getContextPath()%>/role/goList.html?currentPage="+arg;
        form.method="post";
        form.submit();
    }
    $(function(){
        $("#queryBtn").click(function(){
            goPage(1);
        })
    })
    function goAssign(arg){
        window.location.href="<%=request.getContextPath()%>/role/goAssign.html?roleId="+arg;
    }

</script>
</body>
</html>
